﻿@{
    ViewBag.Title = "Nhà đài";
    Layout = "~/Views/Shared/_LayoutContent.cshtml";
}
@using (Html.BeginForm("Search", "Station", FormMethod.Post))
{
    <div class="dv960">
        <div class="dvCustomserSearch">
            <div class="dvTextCamp">
                Chiến dịch</div>
            <div class="dvLineCamp">
                &nbsp;
            </div>
            <div class="dvSearchCamp">
                <input type="text" id="txtSearch" name="txtSearch" style="width: 245px" />
                &nbsp;
                <input type="submit" value="Tìm" name="Search" class="btn" style="width: 35px;" />
            </div>
        </div>
    </div>
}
<div class="clear dvHeight20">
</div>
<div class="dvTitleBook">
    Chiến dịch đang chạy
</div>
<div class="dvArrActive">
    <div class="dvColCampName">
        chiến dịch
    </div>
    <div class="dvColBorder">
    </div>
    <div class="dvColNgay" style="width: 225px;">
        Lịch phát sóng
    </div>
    <div class="dvColBorder">
    </div>
    <div class="dvColNgay" style="width: 225px;">
        Chứng nhận phát sóng
    </div>
    <div class="dvColBorder">
    </div>
    <div class="dvColFileMp3">
        file
    </div>
</div>
<div class="dv960">
    @{
        int stt = 0;
    }
    @foreach (VoiceAd.Models.tblCampaign objCamp in ViewBag.lstActive)
    {
        <div class="dvWidth215">
            @Html.ActionLink(objCamp.Title, "Campaign", new { id = objCamp.Id })
        </div>        
        <div class="dvWidth5">
        </div>
        <div class="dvWidth175 dvTextCenter" style="width: 225px;">
            @{                
        VoiceAd.DAL.IBlockRepository blockRepository = new VoiceAd.DAL.BlockRepository(new VoiceAd.Models.dbVoiceAdDataContext());
        VoiceAd.DAL.IBookingRepository bookingRepository = new VoiceAd.DAL.BookingRepository(new VoiceAd.Models.dbVoiceAdDataContext());

        VoiceAd.Models.tblBooking tblbk = bookingRepository.GetBookingByCampId(objCamp.Id, ViewBag.StationId);
        IEnumerable<VoiceAd.Models.tblBlock> lsttblbl = blockRepository.GetByBookingID(tblbk.Id);
        foreach (VoiceAd.Models.tblBlock tbl in lsttblbl)
        {
                <input type="button" value="@tbl.MonthBook/@tbl.YearBook" class="btn" style="width: 50px;"name="btnSchedule" onclick="location.href='@Url.Action("ViewSchedule", "Station", new { CamId = objCamp.Id, StationId = ViewBag.StationId, monthId = tbl.MonthBook })'" />
        }
            }
        </div>
        <div class="dvWidth5">
        </div>
        <div class="dvWidth175 dvTextCenter" style="width: 225px;">
            @{                                
        foreach (VoiceAd.Models.tblBlock tbl in lsttblbl)
        {
                <input type="button" value="@tbl.MonthBook/@tbl.YearBook" class="btn"  style="width: 50px;" name="btnCertificate" onclick="location.href='@Url.Action("ListCertificate", "Station", new { CamId = objCamp.Id, StationId = ViewBag.StationId, MonthBook = tbl.MonthBook, YearBook = tbl.YearBook })'"/>
        }
            }
        </div>
        <div class="dvWidth5">
        </div>
        <div class="dvWidth200 dvTextCenter">
            @{
        string strId = "IdPlayer" + stt.ToString(); 
            }
            <div id="@strId">
            </div>
            <script type="text/javascript">
                jwplayer("@strId").setup({
                    modes: [{ type: 'html5' }, { type: 'flash', src: 'jwplayer.flash.swf'}],
                    file: '@Url.Content("~/uploads/Customer/" + @objCamp.tblAudioCamps.Where(x => x.CampaignId == objCamp.Id).FirstOrDefault().UrlAudio)',
                    autostart: 'false',
                    type: 'mp3',
                    width: '200',
                    height: '30'
                });
               
            </script>
        </div>
        <div class="clear" style="height: 30px;">
        </div>
        stt++;
    }
</div>
<div class="clear dvHeight20">
</div>
<div class="dvTitleBook">
    Chiến dịch đã chạy
</div>
<div class="dvArrActive">
    <div class="dvColCampName">
        chiến dịch
    </div>
    <div class="dvColBorder">
    </div>
    <div class="dvColNgay" style="width: 225px;">
        Lịch phát sóng
    </div>
    <div class="dvColBorder">
    </div>
    <div class="dvColNgay" style="width: 225px;">
        Chứng nhận phát sóng
    </div>
    <div class="dvColBorder">
    </div>
    <div class="dvColFileMp3">
        file
    </div>
</div>
<div class="dv960">
    @foreach (VoiceAd.Models.tblCampaign objCamp in ViewBag.lstCampaign)
    {
        <div class="dvWidth215">
            @Html.ActionLink(objCamp.Title, "Campaign", new { id = objCamp.Id })
        </div>        
        <div class="dvWidth5">
        </div>
        <div class="dvWidth175 dvTextCenter" style="width: 225px;">
            @{                
        VoiceAd.DAL.IBlockRepository blockRepository = new VoiceAd.DAL.BlockRepository(new VoiceAd.Models.dbVoiceAdDataContext());
        VoiceAd.DAL.IBookingRepository bookingRepository = new VoiceAd.DAL.BookingRepository(new VoiceAd.Models.dbVoiceAdDataContext());

        VoiceAd.Models.tblBooking tblbk = bookingRepository.GetBookingByCampId(objCamp.Id, ViewBag.StationId);
        IEnumerable<VoiceAd.Models.tblBlock> lsttblbl = blockRepository.GetByBookingID(tblbk.Id);
        foreach (VoiceAd.Models.tblBlock tbl in lsttblbl)
        {
                <input type="button" value="@tbl.MonthBook/@tbl.YearBook" class="btn" style="width: 50px;"name="btnSchedule" onclick="location.href='@Url.Action("ViewSchedule", "Station", new { CamId = objCamp.Id, StationId = ViewBag.StationId, monthId = tbl.MonthBook })'" />
        }
            }
        </div>
        <div class="dvWidth5">
        </div>
        <div class="dvWidth175 dvTextCenter" style="width: 225px;">
            @{                                
        foreach (VoiceAd.Models.tblBlock tbl in lsttblbl)
        {
                <input type="button" value="@tbl.MonthBook/@tbl.YearBook" class="btn"  style="width: 50px;" name="btnCertificate" onclick="location.href='@Url.Action("ListCertificate", "Station", new { CamId = objCamp.Id, StationId = ViewBag.StationId, MonthBook = tbl.MonthBook, YearBook = tbl.YearBook })'"/>
        }
            }
        </div>
        <div class="dvWidth5">
        </div>
        <div class="dvWidth200 dvTextCenter">
            @{
        string strId = "IdPlayer" + stt.ToString(); 
            }
            <div id="@strId">
            </div>
            <script type="text/javascript">
                jwplayer("@strId").setup({
                    modes: [{ type: 'html5' }, { type: 'flash', src: 'jwplayer.flash.swf'}],
                    file: '@Url.Content("~/uploads/Customer/" + @objCamp.tblAudioCamps.Where(x => x.CampaignId == objCamp.Id).FirstOrDefault().UrlAudio)',
                    autostart: 'false',
                    type: 'mp3',
                    width: '200',
                    height: '30'
                });
               
            </script>
        </div>
        <div class="clear" style="height: 30px;">
        </div>
        stt++;
    }
</div>
